﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using VisualLib;
using DTBuilderLib;
using Logging;

namespace DeepZoomSingleImage
{
    /// <summary>
    /// This very very simple program will DZ a single jpeg image, as a single DZI.
    /// This is the simplest of the various examples.
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            ///
            /// Make sure we can find the actual image!
            /// 

            FileInfo image = new FileInfo("picture.jpg");
            if (!image.Exists)
            {
                Console.WriteLine("Can't find picture.jpg!");
                return;
            }

            ///
            /// Create a single visual for this guy. We will specify 150 dpi for this image,
            /// though that is arbitrary in this case. The DPI is used to set the scale and the
            /// actual dimensions for this guy when it comes out.
            /// 

            VisualSingleImage v = new VisualSingleImage(image, 150);
            Console.WriteLine("Image size is (x,y) = ({0}, {1})", v.Width, v.Height);

            ///
            /// Ok. Now make a deep zoom image out of this guy!
            /// 0) We pass a console logger so errors can be written to stdout (exceptions also tend to get thrown!)
            /// 1) We set the directory where we want this guy to be output!
            ///    We use "output" so that we can keep our source directory nice and clean!
            /// 2) We set the image quality. This is directly fed to the DZ controls and sets 

            DeepZoomBuilder builder = new DeepZoomBuilder(new LoggerConsole());
            var result = builder.RenderVisual(new DirectoryInfo(".\\output - Single Image"), v);
            Console.WriteLine("The final result can be found in {0}", result.FullName);
        }
    }
}
